package com.yifeixi.validation.controller;

import com.yifeixi.validation.entity.User;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 请求参数校验
 *
 * @author YiFeiXi
 */
@RestController
public class RequestController {

  static final String REQUEST_BODY_MAPPING_PATH = "/user";

  @PostMapping(REQUEST_BODY_MAPPING_PATH)
  public User getUserByBody(@RequestBody @Valid User user) {
    return user;
  }
}
